//
//  YTStashRecordModel.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/11/18.
//

#import "YTStashRecordModel.h"

@implementation YTStashRecordModel

+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"ID":@[@"id"],
    };
}


-(NSString *)productNormsStr{
    if(!_productNormsStr){
        _productNormsStr = [NSString stringWithFormat:@"%@/%@",self.productNorms,self.normsName];
    }
    return _productNormsStr;
}

- (CGFloat)categoryNameH{
    if(_categoryNameH == 0){
        _categoryNameH = [DTKTool textWithtitle:self.categoryName andSize:CGSizeMake(kwt(270), 10000) andFout:kFont(16)].height;
        if(_categoryNameH < kwt(16)){
            _categoryNameH = kwt(16);
        }
    }
    return _categoryNameH;
}
- (CGFloat)productBrandH{
    if(_productBrandH == 0){
        _productBrandH = [DTKTool textWithtitle:self.productBrand andSize:CGSizeMake(kwt(270), 10000) andFout:kFont(16)].height;
        if(_productBrandH < kwt(16)){
            _productBrandH = kwt(16);
        }
    }
    return _productBrandH;
}
- (CGFloat)productNormsStrH{
    if(_productNormsStrH == 0){
        _productNormsStrH = [DTKTool textWithtitle:self.productNormsStr andSize:CGSizeMake(kwt(270), 10000) andFout:kFont(16)].height;
        if(_productNormsStrH < kwt(16)){
            _productNormsStrH = kwt(16);
        }
    }
    return _productNormsStrH;
}
- (CGFloat)expiratDateH{
    if(_expiratDateH == 0){
        _expiratDateH = [DTKTool textWithtitle:self.expiratDate andSize:CGSizeMake(kwt(270), 10000) andFout:kFont(16)].height;
        if(_expiratDateH < kwt(16)){
            _expiratDateH = kwt(16);
        }
    }
    return _expiratDateH;
}
- (CGFloat)HeaderViewH{
    return kwt(109 + 15 * 3) + self.categoryNameH + self.productBrandH + self.productNormsStrH;
}
- (CGFloat)CellH{
    if(self.type == 0){///入库
        return kwt(10 + 48 + 16 * 15) + self.areaNameH + self.addressNameH + self.shelfNumberH;
    } else  if(self.type == 1){///出库
        return kwt(10 + 48 + 16 * 9) + self.areaNameH + self.addressNameH + self.shelfNumberH;
    }
    return 0;
    
}




///仓库区域高度
- (CGFloat)areaNameH{
    if(_areaNameH == 0){
        _areaNameH = [DTKTool textWithtitle:self.areaName andSize:CGSizeMake(kwt(270), 10000) andFout:kFont(16)].height;
        if(_areaNameH < kwt(16)){
            _areaNameH = kwt(16);
        }
    }
    return _areaNameH;
}
///存放位置高度
- (CGFloat)addressNameH{
    if(_addressNameH == 0){
        _addressNameH = [DTKTool textWithtitle:self.addressName andSize:CGSizeMake(kwt(270), 10000) andFout:kFont(16)].height;
        if(_addressNameH < kwt(16)){
            _addressNameH = kwt(16);
        }
    }
    return _addressNameH;
}
///货架编号高度
- (CGFloat)shelfNumberH{
    if(_shelfNumberH == 0){
        _shelfNumberH = [DTKTool textWithtitle:self.shelfNumber andSize:CGSizeMake(kwt(270), 10000) andFout:kFont(16)].height;
        if(_shelfNumberH < kwt(16)){
            _shelfNumberH = kwt(16);
        }
    }
    return _shelfNumberH;
}
@end
